package com.damieoa.damieoa.controller;

import com.damieoa.damieoa.pojo.Staff;
import com.damieoa.damieoa.pojo.StaffStatus;
import com.damieoa.damieoa.service.StaffStatusService;
import com.damieoa.damieoa.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@Transactional
@RequestMapping("/staff_status")
public class StaffStatusController {

    @Autowired
    private StaffStatusService staffStatusService;

    //根据员工id获取员工姓名和调转前部门
    @GetMapping("/queryByStaffId")
    public SysResult queryStaffById(Staff staff){
        return SysResult.success(staffStatusService.queryStaffById(staff));
    }

    //员工部门调动
    @PutMapping("/department")
    public SysResult StaffDepartment(@RequestBody StaffStatus staffStatus){
        staffStatusService.StaffDepartment(staffStatus);
        return SysResult.success();
    }

    //员工岗位调动
    @PutMapping("/station")
    public SysResult StaffStation(@RequestBody StaffStatus staffStatus){
        staffStatusService.StaffStation(staffStatus);
        return SysResult.success();
    }

    //员工离职
    @PutMapping("/dimission")
    public SysResult StaffDimission(@RequestBody StaffStatus staffStatus){
        staffStatusService.StaffDimission(staffStatus);
        return SysResult.success();
    }

}
